x86/hvm/rtc: inject RTC periodic interupts from the vpt code
authorTim Deegan <tim@xen.org>
Tue, 25 Feb 2014 08:29:26 +0000 (09:29 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 25 Feb 2014 08:29:26 +0000 (09:29 +0100)
commitc7e35c6ec705d777c0a11124ec28876f1468f2c5
tree03303ceb3b7da70cf1cf9afdb8dcb85c35e806ea
parent4c15a82f034c9c2213a18b6320834f3906d00ba9
x86/hvm/rtc: inject RTC periodic interupts from the vpt code

Let the vpt code drive the RTC's timer interrupts directly, as it does
for other periodic time sources, and fix up the register state in a
vpt callback when the interrupt is injected.

This fixes a hang seen on Windows 2003 in no-missed-ticks mode, where
when a tick was pending, the early callback from the VPT code would
always set REG_C.PF on every VMENTER; meanwhile the guest was in its
interrupt handler reading REG_C in a loop and waiting to see it clear.

One drawback is that a guest that attempts to suppress RTC periodic
interrupts by failing to read REG_C will receive up to 10 spurious
interrupts, even in 'strict' mode.  However:
 - since all previous RTC models have had this property (including
   the current one, since 'no-ack' mode is hard-coded on) we're
   pretty sure that all guests can handle this; and
 - we're already playing some other interesting games with this
   interrupt in the vpt code.

One other corner case: a guest that enables the PF timer interrupt,
masks the interupt in the APIC and then polls REG_C looking for PF
will not see PF getting set.  The more likely case of enabling the
timers and masking the interrupt with REG_B.PIE is already handled
correctly.

Signed-off-by: Tim Deegan <tim@xen.org>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/hvm/rtc.c
xen/arch/x86/hvm/vpt.c
xen/include/asm-x86/hvm/vpt.h